<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>活动列表</title>
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/easyui.css">
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/icon.css">
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/neweasyui/themes/gray/panel.css">
  <link rel="stylesheet" type="text/css" href="<%=path %>/style/neweasyui/themes/gray/window.css">
  <script type="text/javascript" src="<%=path %>/script/1.11.1.js"></script>
  <script type="text/javascript" src="<%=path %>/script/jquery.easyui.min.js"></script>
  <script type="text/javascript" src="<%=path %>/script/easyui-lang-zh_CN.js"></script>
  <script type="text/javascript" src="<%=path %>/script/dateFormat.js"></script>
  <script type="text/javascript" src="<%=path %>/script/datagrid-bufferview.js"></script>
  <script type="text/javascript" src="<%=path %>/script/common.js"></script>
  <style type="text/css">
    #fm{
      margin:0;
      padding:10px 30px;
    }
    .ftitle{
      font-size:14px;
      font-weight:bold;
      padding:5px 0;
      margin-bottom:10px;
      border-bottom:1px solid #ccc;
    }
    .fitem{
      margin-bottom:17px;
    }
    .fitem label{
      display:inline-block;
      width:80px;
    }
    .fitem input{
      width:230px;
    }
  </style>
</head>
<body>

<div style="width: 500px;">
  <form id="fm" method="post">
    <input type="hidden" name="id" id="id" />
	<div class="fitem">
      <label>兑奖码:</label>
      <input  class="easyui-textbox" name="key" id="key" value=""/>
    </div>
    <div class="fitem">
      <label>金额:</label>
      <span id="content"></span>
    </div>
    <div class="fitem">
      <a href="javascript:void(0)" id="bt" class="easyui-linkbutton" style="width: 90px">兑奖</a>
    </div>
  </form>
</div>
</body>
<script type="text/javascript">
	$(function (){
	    $("#bt").click(function (){
	        var key = $("#key").val();
	        if(key.length == 0) {
	        	alert("兑奖码不能为空");
	        }else {
	        	$.ajax({
		            type: "get",
		            url:"<%=basePath%>/activityManage/exchangKey",
		            async: true,
		            timeout: 15000,
		            data:{key:key},
		            beforeSend: function(xhr) {   //beforeSend定义全局变量
		                xhr.setRequestHeader("If-Modified-Since", "0");  //If-Modified-Since HTTP请求头标签,即比较浏览器缓存页面时间
		            },
		            success: function(data) 
		            {
		            	$("#content").html(data.message);
		            },
	        	});
	        }
	    });    
	});
</script>
</html>
